<?php

namespace App\Listeners;

use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;

class CreateData implements ShouldQueue
{

    /**
     * Handle the event.
     *
     * @param  object  $event
     * @return void
     */
    public function handle($event)
    {
        Artisan::call("migrate");   // 执行数据迁移
        DB::unprepared(file_get_contents(base_path("database/admin.sql")));  // 执行导入数据库关键数据
    }
}
